<?php
require_once ("src/db/connectdatabase.php");

function getAdvertires() {
	$con = new ConnectDB();
	$tbl = "thongbaodealer";
	$fn = array('id', 'titletb', 'sendalldealer', 'datecreate');
	$condetion = array('isuse' => '1');
	return $con -> getvalueorderby($tbl, $fn, $condetion, 'datecreate');
}

function getIntro() {
	$con = new ConnectDB();
	$tbl = " loan_intro_footer";
	$fn = array('header', 'footer');
	$condetion = array('id' => 'info-thong-bao');
	return $con -> getvalue($tbl, $fn, $condetion);
}
$intro = getIntro();
$arrdatas = getAdvertires();
?>
<style>
.tblwt_txt {
	color: #1c50b0;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 13px;
	font-weight: bold;
	padding: 2px;
}

.tbl_txt {
	color: #373737;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
	padding: 2px;
}

#txt a {
	color: #1C50B0;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
	line-height: 15px;
	text-decoration: none;
}

#txt   a {
	text-decoration: none;
}

#txt  a:link {
	color: #666666;
}

#txt   a:visited {
	color: #666666;
}

#txt   a:active {
	color: #666666;
}

#txt   a:hover {
	color: #FF9900;
}
</style>
<div style="float: left; width: 100%; margin-bottom: 20px; clear: right;">
    <div><?php if(count($intro) > 0) { echo($intro[0][0]); } ?></div>
</div>
<div style="clear: both"></div>
<div class="intrl_txt" style="margin: auto;">
	<div style="margin-top: 0px; float: left; clear: right;">
    	<div id="txt">
        	<?php 
			if(count($arrdatas) > 0) {
			?>
        	<table width="960px" border="0" cellpadding="1" cellspacing="1" bgcolor="#d5cfb1">
                <tbody>
                	<?php
					foreach($arrdatas as $entry) {
						$strbanknameurl = $entry[1];
						$strbanknameurl = rewriteTextUrl(stripUnicode($strbanknameurl));
					?>
                    <tr bgcolor="#EFEEEE">
                        <td height="25" align="left" bgcolor="#FFFFFF" class="tbl_txt"><strong><a href="<?php echo($host) ?>profile/chi-tiet-thong-bao/<?php echo($entry[0]) ?>/<?php echo($strbanknameurl) ?>.html"><?php echo($entry[1]) ?></a></strong> <?php echo(int_to_date($entry[3])) ?></td>
                    </tr>
                    <tr></tr>
                    <?php
					}
					?>
                </tbody>
            </table>
            <?php
			} else {
				echo('<h3 style="color:red;">Không có thông báo mới.</h3>');
			}
			?>
            
        </div>
    </div>
</div>
<div style="clear: both"></div>
<div style="float: left; width: 100%; margin-top: 20px; clear: right;">
    <div><?php if(count($intro) > 0) { echo($intro[0][1]); } ?></div>
</div>